package com.chis.prohbase;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 
 * @Description 
 * @Company zwx
 * @author wlj
 * @version 2019年08月19日
 */
public class HbaseTime {

    public static void main(String[] args) {
        File file1 = new File("C:\\Users\\Administrator\\Desktop\\1.txt");
        FileReader m = null;
        try {
            m = new FileReader(file1);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        BufferedReader reader = new BufferedReader(m);
        Map<String,List<Integer>> map = new HashMap<>();
        while (true) {
            String nextline = null;
            try {
                nextline = reader.readLine();
                if (nextline != null && nextline.length() > 8) {

                    if(!nextline.startsWith("Aug")){
                        String tmp = nextline.substring(15,51);
                        String time = nextline.substring(55,65);
                        List<Integer> list = new ArrayList<>();
                        if(map.containsKey(tmp)){
                            list = map.get(tmp);
                        }
                        list.add(Integer.valueOf(time));
                        map.put(tmp,list);
                    }



                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (nextline == null) break;
        }
        for(String id : map.keySet()){
            List<Integer> list = map.get(id);
            if(list.size() == 4){
                Integer t1 = list.get(1)-list.get(0);
                Integer t2 = list.get(2)-list.get(1);
                Integer t3 = list.get(3)-list.get(2);
                System.out.println("应种耗时："+t1+" 档案耗时："+t2+" 码追溯耗时："+t3);
            }


        }
    }
}
